#include"sort.h"
//#include<algorithm>
void TestInsertSort()
{
	//int arr[] = { 1,8,3,5,6,4,9,2,0,7 };
	int arr[] = { 22,5,12,3,2,2,7,1,8,2,5,9,0,3,9,8,7,3,1,0,6,0,9,1,4 };
	int arr1[] = { 1,8,3,5,6,4,9,2,0,7 };
	InsertSort(arr, sizeof(arr) / sizeof(int));
	cout << "InsertSort:    ";
	ArrPrint(arr, sizeof(arr) / sizeof(int));
}

void TestShellSort()
{
	//int arr[] = { 1,8,3,5,6,4,9,2,0,7 };
	int arr[] = { 22,5,12,3,2,2,7,1,8,2,5,9,0,3,9,8,7,3,1,0,6,0,9,1,4 };
	int arr1[] = { 1,8,3,5,6,4,9,2,0,7 };
	ShellSort(arr, sizeof(arr) / sizeof(int));
	cout << "ShellSort:     ";
	ArrPrint(arr, sizeof(arr) / sizeof(int));
}

void TestSelectSort()
{
	//int arr[] = { 1,8,3,5,6,4,9,2,0,7 };
	int arr[] = { 22,5,12,3,2,2,7,1,8,2,5,9,0,3,9,8,7,3,1,0,6,0,9,1,4 };
	int arr1[] = { 1,8,3,5,6,4,9,2,0,7 };
	SelectSort(arr, sizeof(arr) / sizeof(int));
	cout << "SelectSort:    ";
	ArrPrint(arr, sizeof(arr) / sizeof(int));
}

void TestHeapSort()
{
	//int arr[] = { 1,8,3,5,6,4,9,2,0,7 };
	int arr[] = { 22,5,12,3,2,2,7,1,8,2,5,9,0,3,9,8,7,3,1,0,6,0,9,1,4 };
	int arr1[] = { 1,8,3,5,6,4,9,2,0,7 };
	HeapSort(arr, sizeof(arr) / sizeof(int));
	cout << "HeapSort:      ";
	ArrPrint(arr, sizeof(arr) / sizeof(int));
}

void TestBubbleSort()
{
	//int arr[] = { 1,8,3,5,6,4,9,2,0,7 };
	int arr[] = { 22,5,12,3,2,2,7,1,8,2,5,9,0,3,9,8,7,3,1,0,6,0,9,1,4 };
	int arr1[] = { 1,8,3,5,6,4,9,2,0,7 };
	BubbleSort(arr, sizeof(arr) / sizeof(int));
	cout << "BubbleSort:    ";
	ArrPrint(arr, sizeof(arr) / sizeof(int));
}

void TestQuickSort()
{
	int arr[] = { 22,5,12,3,2,2,7,1,8,2,5,9,0,3,9,8,7,3,1,0,6,0,9,1,4 };
	int arr1[] = { 1,8,3,5,6,4,9,2,0,7 };
	QuickSort(arr, 0, sizeof(arr) / sizeof(int) - 1);
	cout << "QuickSort:     ";
	ArrPrint(arr, sizeof(arr) / sizeof(int));
}

void TestQuickSortNonR()
{
	int arr[] = { 22,5,12,3,2,2,7,1,8,2,5,9,0,3,9,8,7,3,1,0,6,0,9,1,4 };
	int arr1[] = { 1,8,3,5,6,4,9,2,0,7 };
	QuickSortNonR(arr, 0, sizeof(arr) / sizeof(int) - 1);
	cout << "QuickSortNonR: ";
	ArrPrint(arr, sizeof(arr) / sizeof(int));

}

void TestMergeSort()
{
	vector<int>arr{ 22,5,12,3,2,2,7,1,8,2,5,9,0,3,9,8,7,3,1,0,6,0,9,1,4 };
	vector<int>arr1{ 1,8,3,5,6,4,9,2,0,7 };
	MergeSort(arr, 0, arr.size() - 1);
	cout << "MergeSort:     ";
	for (auto num : arr)
		cout << num << ' ';
	cout << endl;
}

void TestMergeSortNonR()
{
	vector<int>arr{ 22,5,12,3,2,2,7,1,8,2,5,9,0,3,9,8,7,3,1,0,6,0,9,1,4 };
	vector<int>arr1{ 1,8,3,5,6,4,9,2,0,7 };
	MergeSortNonR(arr, 0, arr.size() - 1);
	cout << "MergeSortNonR: ";
	for (auto num : arr)
		cout << num << ' ';
	cout << endl;
}

int main()
{
	TestInsertSort();
	TestShellSort();
	TestSelectSort();
	TestHeapSort();
	TestBubbleSort();
	TestQuickSort();
	TestQuickSortNonR();
	TestMergeSort();
	TestMergeSortNonR();
	return 0;
}